<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue_2.5.22.js"></script>
    <script src="./js/vue-router_3.0.2.js"></script>
</head>
<div id="app">
    <router-link to="/user">User</router-link>
    <router-link to="/register">Register</router-link>

    <router-view></router-view>

</div>

<body>

    <script>
        var User = {
            template: '<h1>User</h1>'
        }
        var Register = {
            template: `
            <div>
            <h1>Register</h1>
            <hr/>
            <router-link to="/register/tab1">tab1</router-link>
    <router-link to="/register/tab2">tab2</router-link>
    </router-view/>
</div>
            `
        }
        var Tab1 = {
            template: '<h1>tab1</h1>'
        }
        var Tab2 = {
            template: '<h1>tab2</h1>'
        }
        var router = new VueRouter({
            routes: [{
                path: '/',
                redirect: '/user'
            }, {
                path: '/user',
                component: User
            }, {
                path: '/register',
                component: Register,
                children: [{
                    path: '/register/tab1',
                    component: Tab1
                }, {
                    path: '/register/tab2',
                    component: Tab2
                }]
            }]
        })
        var vm = new Vue({
            el: '#app',
            data: {},
            router
        })
    </script>
</body>

</html>